package com.estun.backroundManagementService.task;

import com.estun.backroundManagementService.domain.BaseResponse;
import com.estun.backroundManagementService.modules.material.service.MaterialService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Profile;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;


@Slf4j
@Component
@AllArgsConstructor
@Profile("prd")
public class SyncMaterialTask {

    private final MaterialService materialService;

    /**
     * 物料主数据同步任务 每小时同步一次
     */
    @Scheduled(fixedRate = 60 * 60 * 1000)
    public void refreshWorkOrderStatus() {
        log.info("【物料主数据同步 定时任务】 任务开始----");
        BaseResponse res = materialService.sync();
        log.info("【物料主数据同步 定时任务】 任务结果:{}", res);
        log.info("【物料主数据同步 定时任务】 任务结束----");
    }


}
